﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace DAL
{
    public class BaseDAL
    {
        private SqlConnection Cnn { get; set; }
        protected SqlCommand Cmd { get; set; }

        public BaseDAL()
        {
            Cnn = new SqlConnection(@"Data Source=.;Initial Catalog=xDOMv1;Persist Security Info=True;User ID=sa;Password=sa");
            Cmd = new SqlCommand();
            Cmd.Connection = Cnn;
        }

        protected void Open()
        {
            if (Cnn.State == System.Data.ConnectionState.Closed) Cnn.Open();
        }

        protected void Close()
        {
            if (Cnn.State != System.Data.ConnectionState.Closed) Cnn.Close();
        }
    }
}